package com.winz.cultureapp.adapter.xrcv;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.mine.xrecyclerview.rcvadapter.BaseRcvAdapter;
import com.mine.xrecyclerview.rcvadapter.ViewHolder;
import com.winz.cultureapp.R;
import com.winz.cultureapp.entity.StadiumListBean;

import java.util.List;

import jp.wasabeef.glide.transformations.RoundedCornersTransformation;

/**
 * 场馆
 */

public class StadiumDataAdapter extends BaseRcvAdapter<StadiumListBean.DataBean.ListBean> {

    public StadiumDataAdapter(Context context, List<StadiumListBean.DataBean.ListBean> datas, int... resid) {
        super(context, datas, resid);
    }

    @Override
    public void convert(ViewHolder holder, StadiumListBean.DataBean.ListBean data, int itemViewType) {

    }

    @Override
    public void convert(int position, ViewHolder holder, StadiumListBean.DataBean.ListBean listBean, int itemViewType) {
        super.convert(position, holder, listBean, itemViewType);
        if (itemViewType != -1){
            if (position == 0){
                holder.getView(R.id.view_diliver).setVisibility(View.GONE);
            }else{
                holder.getView(R.id.view_diliver).setVisibility(View.VISIBLE);
            }
            holder.setText(R.id.tv_name,listBean.unitName)
                    .setText(R.id.tv_location,listBean.address)
                    .setText(R.id.tv_num,listBean.childNum+ "");
//0
            //圆角处理
            Glide.with(mContext)
                    .load(listBean.imageUrl)
                    .error(R.drawable.pic_default)
                    .into((ImageView) holder.getView(R.id.iv_pic));
        }
    }
}
